package com.qh.basic.listener;

import com.qh.system.service.IPermissionService;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener
public class PermissionScanInitListener implements ServletContextListener {

    @Autowired
    private IPermissionService permissionService;
    @Override
    public void contextInitialized(ServletContextEvent sce){
        //扫描我们的自定义注解：获取name和sn
        //扫描我们的每个接口类：1.类上边的requestMapping()和方法上的XXXMapping
//        System.out.println("上下文对象创建成功");

        new Thread(new Runnable() {
            @Override
            public void run() {
                permissionService.scanPermission();
            }
        }).start();
    }
}
